package com.pcdandan.pcdandan.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.pcdandan.pcdandan.config.token.PcdandanTicket;
import com.pcdandan.pcdandan.service.PcdandanService;


@RestController
@RequestMapping("/index")
public class IndexController {
	
	@Autowired
	private PcdandanService service;
	
	@RequestMapping("/login")
	public String login() {
		PcdandanTicket ticket = new PcdandanTicket();
		ticket.setDomain("pcdandan");
		ticket.setIdentify("me");
		ticket.setMethod("login");
		return service.login(ticket)+"";
	}
	
	@RequestMapping("/auto")
	public String auto() {
		PcdandanTicket ticket = new PcdandanTicket();
		ticket.setDomain("pcdandan");
		ticket.setIdentify("me");
		ticket.setMethod("auto");
		return JSONObject.toJSONString(service.auto(ticket));
	}

}
